(function ($) {
	$(function () {
		nav(); 
		
	});
	
	function nav() {
		var $liCur = $(".nav-box>ul>li a.cur"),
			curP = $liCur.position().left,
			curW = $liCur.outerWidth(true),
			$slider = $(".nav-line"),
			$targetEle = $(".nav-box>ul>li:not('.last')"),
			$navBox = $(".nav-box");
		$slider.stop(true, true).animate({
			"left" : curP,
			"width" : curW
		});
		$targetEle.mouseenter(function () {
			$liCur.removeClass('cur');
			var $_parent = $(this);//.parent(),
			_width = $_parent.outerWidth(true),
			posL = $_parent.position().left;
			$slider.stop(true, true).animate({
				"left" : posL,
				"width" : _width
			}, "fast");
		});
		$navBox.mouseleave(function (cur, wid) {
			$liCur.first().addClass('cur');			
			cur = curP;
			wid = curW;
			$slider.stop(true, true).animate({
				"left" : cur,
				"width" : wid
			}, "fast");
			
		});
		
		$(".nav-box ul li a").hover(function(){
	        $(this).siblings('.nav-box ul li a').removeClass(".cur");
	    })
	};
	
})(jQuery);
